from word_play_functions import *

def index(lt):
    count = 0
    word = 'abcdefghijklmnopqrstuvwxyz'
    for letter in word:
        if letter == lt:
            return count;
        count = count + 1

fin = open('D:\SVN_dir\words.txt')
count = 0
count_avoid = 0
#str_a = raw_input('Please input a string to avoid')
alfa_bet = 'abcdefghijklmnopqrstuvwxyz'
count_str_a = 0
special_comb = ''
special_comb1 = ''
min_count = max_count = avoid_word_num(fin, 'abcde')
fout = open('forbidden_list.txt','w')
for lt1 in alfa_bet[:-4]:
    print '*',
    for lt2 in alfa_bet[index(lt1)+1:-3]:
        for lt3 in alfa_bet[index(lt2)+1:-2]:
            for lt4 in alfa_bet[index(lt3)+1:-1]:
                print "#",
                for lt5 in alfa_bet[index(lt4)+1:]:
                    str_temp = lt1+lt2+lt3+lt4+lt5
                    #print str_temp
                    #fin.seek(0)
                    count_str_a = count_str_a + 1
                    count_avoid = avoid_word_num(fin, str_temp)
                    file_line = str_temp +'\t***\t'+ str(count_avoid)+'\n'
                    fout.writelines(file_line)
                    if count_avoid < min_count:
                        min_count = count_avoid
                        special_comb = str_temp
                    if count_avoid > max_count:
                        max_count = count_avoid
                        special_comb1 = str_temp

                    
#print 'index(a) = ',index('a')
#print 'index(f) = ',index('f')
                
fin.close()

print 'count_str_a =', count_str_a                
    
print 'special_comb =', special_comb

print 'minimum word number =', min_count 

print 'special_comb1 =', special_comb1

print 'maximum word number =', max_count 

